package com.inibb.app.validator;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import com.inibb.app.vo.security.RoleDTO;





public class RoleValidator implements Validator {

	protected final Log logger = LogFactory.getLog(getClass());
	
	public boolean supports(Class objClass) {
		return RoleDTO.class.isAssignableFrom(objClass);
	}

	public void validate(Object bean, Errors errors) {
		logger.debug("RoleValidator validate");
		
		/*
			name	: field name
			empty : error message key
			Role name is Required field : default error message
		*/
		ValidationUtils.rejectIfEmpty(errors, "name", "empty","Role name is required!");
	}

}
